<?php
namespace Admin\Model;
use Think\Model;
class WebUserModel extends Model {

	/**
	 * 子账号列表
	 * @return [type] [description]
	 */
	public function manage(){

		$data = M('web_user');
		$where['web_type']=$_GET['web_type']?$_GET['web_type']:array('IN','0,1');
		$where['p_u_id']=$_SESSION['user']['u_id'];
		if($_GET['search']){
			$search=$_GET['search'];
			$oa['web_phone']=array('like','%'.$search.'%');
			$oa['web_name']=array('like','%'.$search.'%');
			$oa['_logic'] = 'or';
			$where['_complex'] = $oa;
		}
		$where['web_type']=$_GET['web_type']?$_GET['web_type']:array('IN','0,1');
		$where['p_u_id']=$_SESSION['user']['u_id'];
		if(!$_GET['p'])$_get['p']=1;
		$count      = $data->where($where)->count();
		$Page       = new \Think\Page($count,5);
		$show       = $Page->show();
		$list = $data->where($where)->limit($Page->firstRow.','.$Page->listRows)->select();
		return array('count'=>$count,'list'=>$list,'Page'=>$Page);

	}
	
}